#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/workqueue.h>

static void workqueue_handler(struct work_struct *work)
{
	printk("%s Start.\n", __FUNCTION__);
	msleep(1000);
	printk("%s Done.\n", __FUNCTION__);
}

DECLARE_WORK(workqueue_struct, workqueue_handler);

static int __init workqueue_test_init(void)
{
	printk("%s Start.\n", __FUNCTION__);
	schedule_work(&workqueue_struct);
	printk("%s Done.\n", __FUNCTION__);

	return 0;
}

static void __exit workqueue_test_exit(void)
{
	flush_scheduled_work();
	printk("%s Done.\n", __FUNCTION__);
}

module_init(workqueue_test_init);
module_exit(workqueue_test_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("YYW");
